package 作业;

import java.util.Scanner;

public class 字符串替换 {
	public static void main(String[] args) {
		String a;
		String aa = new String();		
		Scanner s = new Scanner(System.in);
		while(true) {
			a = s.nextLine();
			if(a.compareTo("end") == 0)
				break;
			aa = aa.concat(a);
		}
		String b = s.nextLine();
		String c = s.nextLine();
		aa = aa.replace(b, c);
		s.close();
		System.out.println(aa);
	}
}
